﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThietBiSo.LinQDB;

namespace ThietBiSo.Models
{
    public class MSeo
    {
        private _24hmuaonlineDataContext context = new _24hmuaonlineDataContext();
        public SEO FindAll()
        {
            var v = from f in context.SEOs select f;
            return v.SingleOrDefault();
        }
        public string Title()
        {
            var v = from f in context.SEOs select f.Title;
            return v.SingleOrDefault();
        }
        public string Keywords()
        {
            var v = from f in context.SEOs select f.Keywords;
            return v.SingleOrDefault();
        }
        public string Description()
        {
            var v = from f in context.SEOs select f.Description;
            return v.SingleOrDefault();
        }
        public void Save(SEO bv)
        {
            context.SEOs.InsertOnSubmit(bv);
            context.SubmitChanges();
        }
        public void Update(SEO bv)
        {
            var v = from f in context.SEOs
                    select f;
            SEO bvdb = v.SingleOrDefault(d => d.Id.Equals(bv.Id));

            bvdb.Title = bv.Title;
            bvdb.Keywords = bv.Keywords;
            bvdb.Description = bv.Description;
            context.SubmitChanges();
        }
        //public SEO GetByID(int id)
        //{
        //    return (FindAll().Where(d => d.Id == id)).SingleOrDefault();
        //}
    }
}